package com.xkstream.client.ui.live;

import android.graphics.Bitmap;
import android.media.tv.TvTrackInfo;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.xkstream.client.R;
import com.xkstream.client.application.Application;
import com.xkstream.client.appmanager.AppManager;
import com.xkstream.client.base.BaseActivity;
import com.xkstream.client.entity.User;
import com.xkstream.client.utils.AsyncImage;
import com.xkstream.client.utils.BitmapUtil;
import com.xkstream.client.utils.DateUtil;
import com.xkstream.client.utils.LogUtil;
import com.xkstream.client.view.CircleImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by xiaoyi on 2017-9-29.
 */

public class LiveEndActivity extends BaseActivity {
    @BindView(R.id.ivHeader)
    CircleImageView ivHeader;
    @BindView(R.id.tvNickname)
    TextView tvNickname;
    @BindView(R.id.tvLong)
    TextView tvLong;
    @BindView(R.id.tvSure)
    TextView tvSure;
    @BindView(R.id.ivFrame)
    ImageView ivFrame;


    @Override
    protected void initViews(Bundle savedInstanceState) {
        setContentView(R.layout.activity_liveend);
        ButterKnife.bind(this);
        User user = Application.getUser();
        LogUtil.e(TAG, "Bitmap 222222 " + System.currentTimeMillis());
        Bitmap blurCover = BitmapUtil.fastblur(LiveHelper.bitmap, 20);

        if (blurCover != null) {
            ivFrame.setImageBitmap(blurCover);
        } else {
            AsyncImage.loadPhoto(this, user.getAnchor().getAnchor_change_PC(), ivFrame);
        }

        LogUtil.e(TAG, "Bitmap 333333 " + System.currentTimeMillis());


        tvNickname.setText(user.getExt_info().getNickname());
        AsyncImage.loadPhoto(this, user.getExt_info().getHead_icon(), ivHeader);

        long mills = System.currentTimeMillis() - getIntent().getLongExtra("starttime", 0);
        tvLong.setText(DateUtil.formatTime(mills, "HH:mm:ss"));
    }

    @OnClick(R.id.tvSure)
    public void onClick() {
        finish();
    }
}
